package parser;

import antlr.CommonToken;
import antlr.Token;

public final class CodeReviewToken extends CommonToken {
    int id = -1; //synchronized with the token array that is stored in File object

    int startIndex;

    public CodeReviewToken() {
    }

    public CodeReviewToken(String t) {
        super(t);
    }

    public CodeReviewToken(int t, String txt) {
        super(t, txt);
    }

    public CodeReviewToken(Token ct) {
        super.col = ct.getColumn();
        super.line = ct.getLine();
        super.text = ct.getText();
        super.type = ct.getType();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setStartIndex(int i) {
        startIndex = i;
    }

    public int getStartIndex() {
        return startIndex;
    }

    public int getEndIndex() {
        return startIndex + text.length() - 1;
    }

    public void appendDecoratedText(StringBuffer sb) {
        sb.append(getText());
    }

    public String getText() {
        return text;
    }

    public void setText(String s) {
        super.setText(s.intern());
    }

    public String toString() {
        return text;
    }
}